# script 'InstallSolution.ps1'

Write-Host 
# define variables for script
$PackagePath = "..\bin\Debug\Expertime.Multitude.Intranet.wsp"
$PackageName = "Expertime.Multitude.Intranet.wsp"
$SiteUrl = "http://win-scjail07sml:81/"

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
Write-Host "Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

# Add SPSolution
Write-Host "Adding Solution :"  -foregroundcolor Magenta
Write-Host "- Path		 	= " $PackagePath -foregroundcolor Magenta
Add-SPSolution -LiteralPath $PackagePath -Verbose

# Install SPSolution
Write-Host 
Write-Host "Installing Solution :"  -foregroundcolor Magenta
Write-Host "- Package		 = " $PackageName -foregroundcolor Magenta
Write-Host "- WebApplication = " $SiteUrl -foregroundcolor Magenta
Install-SPSolution -Identity $PackageName -WebApplication $SiteUrl -GACDeployment -Force -Verbose

# display site info
Write-Host 
Write-Host "Solution installed successfully" -foregroundcolor Green